package 蓝桥真题;

public class 平方序列 {
       public static void main(String[] args) {
		      long n=2019*2019;
		      long x=2020;
		      long tmp[]={0x3f3f3f3f,0x3f3f3f3f};
		      int f=0;
		      while(true){
		    	    long t=x*x;
		    	    long y=t+t-n;
		    	    t=(long)Math.sqrt(y);
		    	    if(t*t==y){
		    	    	if((x+t)<tmp[0]+tmp[1]){
		    	    		tmp[0]=x;
		    	    		tmp[1]=t;
		    	    	}
		    	    	System.out.println(x+" "+t);
		    	    	if(f++>20)break;
		    	    }
		    	    x++;
		      }
		      System.out.print(tmp[0]+tmp[1]);
	}
}
